import request from '@/utils/request'
import { ADMIN } from '@/config/baseUrl'

// 查询数据字典列表
export function listCode(query) {
  return request({
    url: ADMIN + '/system/crccode/list',
    method: 'get',
    params: query
  })
}

// 查询数据字典详细
export function getCode(id) {
  return request({
    url: ADMIN + '/system/crccode/findCode',
    method: 'get',
    params: {id: id}
  })
}

// 新增数据字典
export function addCode(data) {
  return request({
    url: ADMIN + '/system/crccode',
    method: 'post',
    data: data
  })
}

// 修改数据字典
export function updateCode(data) {
  return request({
    url: ADMIN + '/system/crccode',
    method: 'put',
    data: data
  })
}

// 删除数据字典
export function delCode(ids) {
  return request({
    url: ADMIN + `/system/crccode/remove?ids=${ids.join(',')}`,
    method: 'delete'
 })
}

// 导出数据字典
export function exportCode(query) {
  return request({
    url: ADMIN + '/system/crccode/export',
    method: 'post',
    data: query
  })
}

// 查询字典类型详细
export function getDicts(dictId) {
  return request({
    url: ADMIN + '/system/crccode/type/' + dictId,
    method: 'get'
  })
}

